use std::fs;

#[derive(Default)]
pub struct Buffer {
    pub lines: Vec<String>,
}
impl Buffer {
 pub   fn load(file_name:Option<&String>) -> Self {
        let mut lines=vec![];
        if let Some(file_name)=file_name{
            let content= fs::read_to_string(file_name).unwrap();
            for l in content.lines() {
                lines.push(l.to_string());
            }
        }else{
            lines.push(String::from("Hello world!"));
        }

        Self {
            lines
        }
    }

}
